import Vue from "vue";
import Vuex from "vuex";
import { getIndexData } from "@/api/dataV/index";
Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    fieldObj: {
      carCount: 111,
      carRepairCount: 0,
      carUnusedCount: 112,
      carUseCount: 0,
      dayCount: 0,
      dayRate: 0,
      maxCarBrandModelDayRate: { brandModelName: "", carBrandModelDayRate: 0 },
      monthCount: 0,
      monthMileage: 0,
      totalCount: 0,
      totalMileage: 0,
    },
  },
  getters: {},
  mutations: {
    FIELD_OBJ: (state, paly) => {
      state.fieldObj = paly;
    },
  },
  actions: {
    queryObj({ commit }) {
      getIndexData().then((res) => {
        const { data } = res;
        console.log(data,"store---------------")
        commit("FIELD_OBJ", data);
      });
    },
  },
  modules: {},
});
